

		**********************************************************
		** File: Figure_G6.do									**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 11, 2021									**
		** Task: LOOKING AT LATENT PARAMETER THETA				**
 		**********************************************************
 
 
	clear
	version 16.1
	set seed 1234

	cd "~"


	**************
	*** STATIC ***
	**************
	
	clear
	import delimited "static_thetas.csv"
	rename theta_mean mean_s
	rename theta_sd sd_s
	save "static_theta.dta", replace

	***************
	*** Dynamic ***
	***************
	
	clear
	import delimited "dynamic_thetas.csv"
	save "dynamic_theta.dta", replace


	***

	merge 1:1 ccode year using "static_theta.dta"

	rename theta_mean mean_d
	rename theta_sd sd_d
	drop _merge

	save hti_stan_thetas_cyear.dta, replace

	collapse (mean) mean* sd*, by(year)
 
	gen upper_d=mean_d + (1.96*sd_d)
	gen lower_d=mean_d - (1.96*sd_d)

	gen upper_s=mean_s + (1.96*sd_s)
	gen lower_s=mean_s - (1.96*sd_s)

	twoway (rspike lower_d upper_d year, vertical  legend(pos(6) cols(2))) ///
	(rspike lower_s upper_s year, vertical)	///
			(scatter mean_s year) ///
			(scatter mean_d year)  
			
